﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MasterNhanSuTienLuong.Master" Inherits="System.Web.Mvc.ViewPage<QLPKWeb.Models.FormBean.NhanVienModel.TamUngForm>" %>

<%@ Import Namespace="QLPKWeb.BussinessDelegate.CommonDelegate" %>
<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>

<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" src="<%= ResolveUrl("~/Content/Scripts/NhanVien/TamUng.js") %>"></script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
     <script language="javascript" type="text/javascript">
         $(document).ready(function () {
             selectMenu("TamUng-TamUng");
             $("#TamUng-TamUng").parent().attr("class", "expanded");
         });
    </script>
    <div class="box">
        
        <div class="breadcrumbs">
            <ul>
                <li class="home"><a href="">Quản Lý Nhân Viên</a></li>
                <li>Bảng Tạm Ứng Tháng <%= Model.ThangTamUng.ToString("#0")%>/<%= Model.NamTamUng%></li>
            </ul>
        </div>
        <div class="headlines">
            <h2>
                <span>Tạm Ứng Tháng <%= Model.ThangTamUng.ToString("#0")%>/<%= Model.NamTamUng%></span>
            </h2>
        </div>
        
        <div class="box-content">
            <table class="table_outsite" style="width: 100%;">
                <tr>
                    <td colspan="2">
                        <div id="Message" class="MessageError">
                        </div>
                        <div id="MessageSuccess" class="MessageSuccess">
                            <%=Model.MessageSuccess%>
                        </div>
                        <div id="MessageError" class="MessageError" style="font-size: 12px; color: Red; font-weight: bold">
                            <%=Model.MessageError%>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: left">
                        <b title="Danh sách nhân viên tạm ứng">Danh Sách Nhân Viên Tạm Ứng</b>
                    </td>
                    <td align="right">
                        <input type="text" id="SearchByHoTen" name="SearchByHoTen" value="<%= Model.SearchByHoTen %>" title="Nhập Họ Tên hoặc Số Thẻ" onkeypress="if (event.keyCode==13) { return DoSearch(); }" style="width: 150px;"/>
                        <input type="button" id="btnSearch" value="Tìm" title="Tìm nhân viên"/>
                        <input type="button" value="Tạm Ứng" id="btnThemTamUng" <% if(Model.IsLock || Model.IsFinish) {%>disabled="disabled"<%}%> />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table class="tab tab-drag">
                            <thead>
                                <tr class="title">
                                    <td class="first" align="center" nowrap="nowrap" style="width: 80px;">
                                        <strong>STT</strong>
                                    </td>
                                    <td nowrap="nowrap" align="center">
                                        <strong>Số Thẻ</strong>
                                    </td>
                                    <td nowrap="nowrap">
                                        <strong>Họ tên</strong>
                                    </td>
                                    <td nowrap="nowrap" align="center" style="width: 80px;">
                                        <strong>Ngày tạm ứng</strong>
                                    </td>
                                    <td nowrap="nowrap">
                                        <strong>Số tiền (VNĐ)</strong>
                                    </td>
                                    <td class="last">
                                        &nbsp;
                                    </td>
                                </tr>
                            </thead>
                            <tbody>
                                <% 
                                    int sttNhanVien = (Model.PageIndex - 1) * Model.ItemPerPage + 1;
                                    foreach (var item in Model.ListTamUng)
                                    {
                                %>
                                <tr class="item_row">
                                    <td align="center">
                                        <%= sttNhanVien%>
                                    </td>
                                    <td style="text-align: center; width: 60px;">
                                        <%= item.SoThe%>
                                    </td>
                                    <td nowrap="nowrap">
                                        <%= item.HoTen%>
                                    </td>
                                    <td nowrap="nowrap" style="text-align: center;">
                                        <%= item.NgayTamUng%>
                                    </td>
                                    <td>
                                        <%= item.SoTien%>
                                    </td>
                                    <td class="last" style="text-align: center;">
                                        <span style="color: #00f; cursor: pointer" onclick="javascript:DoEditTamUng(<%= item.Id %>);">Chi tiết</span> | 
                                        <span style="color: #00f; cursor: pointer" onclick="javascript:DoDelete(<%= item.Id %>);">Xóa</span>
                                    </td>
                                </tr>
                                <%
                                        sttNhanVien++;
                                    }
                                %>
                            </tbody>
                            <tfoot>
                                <tr class="border_bottom">
                                    <td class="first" style="background: #DDDDDD">
                                    </td>
                                    <td class="last" colspan="5" align="right" style="background: #DDDDDD; padding-right: 10px">
                                        <%
                                            PagerOptions pagerOptions = new PagerOptions();
                                            CommonDelegate CommonDelegate
                                                = new CommonDelegate();
                                            CommonDelegate.ChangeTextPaging(pagerOptions, "pageIndex");
                                        %>
                                        <div>
                                            <%=Html.Pager(Model.TotalPage, Model.PageIndex, "TamUng", "NhanVien", pagerOptions, "Default",
                                                                new
                                                                {
                                                                    thang = Model.ThangTamUng,
                                                                    nam = Model.NamTamUng,
                                                                    idPhongBan = Model.SearchByIdPhongBan,
                                                                    idChucVu = Model.SearchByIdChucVu,
                                                                    hoTen = Model.SearchByHoTen,
                                                                    pageIndex = Model.PageIndex
                                                                }, new object())%>
                                        </div>
                                    </td>
                                </tr>
                            </tfoot>
                        
                        </table>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    
    <div id="boxTamUng" title="Thông Tin Tạm Ứng" style="display: none;">

        <form id="form1" class="formBox">
            <input type="hidden" id="Id" name="Id"/>
            <%: Html.HiddenFor(p => p.IdNhanVien)%>
            <%: Html.HiddenFor(p => p.ThangTamUng)%>
            <%: Html.HiddenFor(p => p.NamTamUng)%>
            <%: Html.HiddenFor(p => p.IsLock)%>
            <%: Html.HiddenFor(p => p.IsFinish)%>
            <%: Html.HiddenFor(p => p.PageIndex)%>

            <table class="table_input" style="width: 100%">
                <tr>
                    <td nowrap="nowrap" style="width: 150px; vertical-align: top;">
                        Nhân viên <span class="red">(*)</span>
                    </td>
                    <td>
                        <%=Html.DropDownList("cbNhanVienCoTrongTamUng", Model.SelectListNhanVien, new { style = " width:99%", disabled = "disabled" })%>
                        <%=Html.DropDownList("cbNhanVienKhongCoTrongTamUng", Model.SelectListNhanVien, new { style = " width:99%" })%>
                        <div class="red" id="NhanVienMessage"></div>
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap" style="vertical-align: top;">
                        Số tiền tạm ứng <span class="red">(*)</span>
                    </td>
                    <td>
                        <input type="text" id="SoTien" name="SoTien" style="width: 98%" onchange="onchangeChiNhapSo(this);" onkeyup="keyupChiNhapSo(this);" maxlength="10" />
                        <div class="red" id="SoTienMessage"></div>
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap" style="vertical-align: top;">
                        Ngày tạm ứng <span class="red">(*)</span>
                    </td>
                    <td>
                        <input type="text" id="NgayTamUng" name="NgayTamUng"  style="width: 98%" />
                        <div class="red" id="NgayTamUngMessage"></div>
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap" style="vertical-align: top;">
                        Lý do
                    </td>
                    <td>
                        <textarea id="LyDo" name="LyDo" style="width: 98%"></textarea>
                        <div class="red" id="LyDoMessage"></div>
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap" style="vertical-align: top;">
                        Ghi chú
                    </td>
                    <td>
                        <textarea id="GhiChu" name="GhiChu" style="width: 98%"></textarea>
                        <div class="red" id="GhiChuMessage"></div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="pagebreak">&nbsp;</div>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td align="right">
                        <input type="button" id="btnSave" name="btnSave" value="Lưu" <% if(Model.IsLock || Model.IsFinish) {%>disabled="disabled"<%}%> />
                        <input type="button" id="btnClose" name="btnClose" value="Đóng" />
                    </td>
                </tr>
            </table>

        </form>
    </div>

</asp:Content>
